package cn.tedu.baidashi.controller;

import cn.tedu.baidashi.service.Impl.ProvinceServiceImpl;
import cn.tedu.baidashi.vo.ProvinceVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author tedu.cn
 * @since 2022-02-16
 */
@RestController
@RequestMapping("/portal")
public class ProvinceController {
    @Autowired
    ProvinceServiceImpl provinceService;

    @GetMapping("/province")
    public List<ProvinceVo> getProvinceNames(
    ){
        List<ProvinceVo> provinceVos=provinceService.getProvinceNames();
        return provinceVos;
    }
    @GetMapping("/{id}/province")
    public ProvinceVo getProvinceNamesById(
            @PathVariable Integer id
    ){
        ProvinceVo provinceVo=provinceService.selectProvinceById(id);
        return provinceVo;
    }
}
